$(function() {
    if (typeof(Storage) !== "undefined")
    {
        $.post(localStorage.domain_app+"/webservice/event/getEventById.php", {
            event_id: sessionStorage.event_edit_id,
            user_id: localStorage.userID

        }, function(res) {
            if (res.error == 0) {
                if(res.title !=""){
                    $('input[name="event-name"]').val(res.title);
                }
                if(res.start_date !=""){
                    $('input[name="event-date"]').prop('type', 'date');
                    $('input[name="event-date"]').val(res.start_date);
                }
                if(res.start_time !=""){
                    $('input[name="start-time"]').prop('type', 'time');
                   $('input[name="start-time"]').val(res.start_time);
                }
                if(res.end_time !=""){
                    $('input[name="end-time"]').prop('type', 'time');
                   $('input[name="end-time"]').val(res.end_time);
                }
                if(res.location !=""){
                     $('input[name="location"]').val(res.location);
                }
                if(res.description !=""){
                    $('textarea[name="description"]').val(res.description);
                }
               } else {
                print_alert(res.msg);
                wd_redirect("event.html");
            }
        }, "json");

    }
    else
    {
        return false;
    }

});